import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { createPinia } from 'pinia'

// Element Plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import locale from 'element-plus/es/locale/lang/zh-cn'

// // 引入 WebSocket 服务
// import webSocketService from '@/utils/websocket'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus, { locale })

// // 启动 WebSocket 连接
// webSocketService.connect().catch((error) => {
//   console.error('❌ WebSocket 连接失败:', error)
// })

app.mount('#app')
